//
//  DetailViewController.m
//  KoreaFlower
//
//  Created by Nicejinux on 12. 11. 10..
//  Copyright (c) 2012년 Nicejinux. All rights reserved.
//

#import "DetailViewController.h"

@interface DetailViewController ()

@end

@implementation DetailViewController

@synthesize indexLabel;
@synthesize indexLabelString, titleLabelString;
@synthesize titleLabel, titleLabelShadow;
@synthesize mainImgView;
@synthesize detailDic;
@synthesize urlPrefix;

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    [indexLabel setText:indexLabelString];
    [self setTitle:titleLabelString];
    [self.navigationController.navigationBar setHidden:YES];
    
    NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
    NSString *cdn = [ud objectForKey:@"cdn0"];
    NSString *name = [detailDic objectForKey:@"imgName"];
    NSString *surfix = [detailDic objectForKey:@"imgNameSurfix"];
    
    if ([surfix isEqual:[NSNull null]]) {
        surfix = @"";
    }
    NSString *url = [NSString stringWithFormat:@"%@%@%@.jpg",cdn, name, surfix];
    
    [mainImgView loadURLImage:url loadingImage:@"Loading.png" noImage:@"Loading.png"];
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (IBAction)popView:(id)sender
{
    [self.navigationController popViewControllerAnimated:YES];
}

- (void)setTitle:(NSString *)title
{
    [self.titleLabel setText:title];
    [self.titleLabelShadow setText:title];
}

- (void)viewDidUnload {
    [self setIndexLabel:nil];
    [self setTitleLabel:nil];
    [self setTitleLabelShadow:nil];
    [self setMainImgView:nil];
    [super viewDidUnload];
}
@end
